from flask import Flask,render_template
import json
from B_plus import build_tree,visual
app=Flask(__name__)

@app.route("/bpt")
def visualize():
    arr = [55, 97, 15, 44, 72, 10, 21, 37, 51, 63, 85, 91, 100]
    values = ["五十五", "九十七", "十五", "四十四", "七十二", "十", "二十一", "三十七", "五十一", "六十三", "八十五", "九十一", "一百"]
    bpt = build_tree(arr, values)
    result = visual(bpt)
    jsonstr = json.dumps(result)
    return jsonstr

@app.route("/")
def index():
    return render_template("index.html")